# *******************************************
# Juan C. Caicedo
# jccaicedoru@bt.unal.edu.co
# Universidad Nacional de Colombia
# 2011
# *******************************************

import math
import sys

N = 200         # Change this to present the number of training instances.
eta0 = 0.1      # Initial learning rate; change this if desired.

def update(W, x, y, eta):
    # Compute the inner product of features and their weights.
    e = y - W*x

    # Compute the gradient of the error function (avoiding +Inf overflow).
    g = -e*x

    # Update the feature weights by Stochastic Gradient Descent.
    W -= eta * g
    return W

def train(fi):
    t = 1
    W = 0.0 #collections.defaultdict(float)
    # Loop for instances.
    for line in fi:
        fields = line.strip('\n').split('\t')
        W = update(W, float(fields[0]), float(fields[1]), eta0 / (1 + t / float(N)))
        t += 1
    return W

if __name__ == '__main__':
    W = train(sys.stdin)
    print W
